<?php
//------------------------------------------------------------------------------
// Class              : ModelBase
// Modification       :
//------------------------------------------------------------------------------
// Date(yyyy.mm.dd)   Developer                       Action
//------------------------------------------------------------------------------
// 2007.03.08         ThanhTX                     Created 
//------------------------------------------------------------------------------
// 2007.02.06        Tran Thanh                      Update
class ControlBase{
	//==========================================================================
	// Function    : ControlBase
	// Argument    :
	// ReturnValue :
	// Creator     : Tran Thanh 2007.06.02
	// Details     : AppendData record of table
	//==========================================================================
	function ControlBase( ){
		 global $db;
	   	 $this->db = new MySql();
		 $this->db = &$db;
	}
	//==========================================================================
	// Function    : execute
	// Argument    :
	// ReturnValue :
	// Creator     : Tran Thanh 2007.06.02
	// Details     : AppendData record of table
	//==========================================================================
	function execute($action){
		echo "Method execute not define!";
	}
	//==========================================================================
	// Function    : getAll
	// Argument    :
	// ReturnValue :
	// Creator     : Tran Thanh 2007.06.02
	// Details     : AppendData record of table
	//==========================================================================
	function getAll(){

	}
	//--------------------------------------------------------------------------
	//	Fucntion : DoUploadFileDriver()
	//  Outline  : upaload file to folder in the server
	//  Create   : ThanhTX 2007.05.02
	//--------------------------------------------------------------------------
	function DoUploadFileDriver(){
		if ($_FILES["userfile"]['name'] != ""){
			$dir =DIR_UPLOADFILE_DOWNLOAD;
			if(move_uploaded_file( $_FILES["userfile"]['tmp_name'], $dir.$_FILES["userfile"]['name'])){ 
			}
			else
			{
				echo "Không upload được file driver";
			}
		}
	}
	//--------------------------------------------------------------------------
	//	Fucntion : DoUploadFileBaogia()
	//  Outline  : upaload file to folder in the server
	//  Create   : ThanhTX 2007.05.02
	//--------------------------------------------------------------------------
	function DoUploadFileBaogia(){
		if ($_FILES["userfile"]['name'] != ""){
			$dir =DIR_UPLOADFILE_DOWNLOAD_BAO_GIA;
			if(move_uploaded_file( $_FILES["userfile"]['tmp_name'], $dir.time()."_".$_FILES["userfile"]['name'])){ 
			}
			else
			{
				echo "Không upload được file báo giá";
			}
		}
	}
	//--------------------------------------------------------------------------
	//	Fucntion : DoUploadFile()
	//  Outline  : upaload file to folder in the server
	//  Create   : ThanhTX 2007.05.02
	//--------------------------------------------------------------------------
	function DoUploadFile(){
		if ($_FILES["userfile"]['name'] != ""){
			$dir =DIR_UPLOADFILE_IMAGES;
			if(move_uploaded_file( $_FILES["userfile"]['tmp_name'], $dir.$_FILES["userfile"]['name'])){ 
			}
			else
			{
				echo "Không upload được file ảnh";
			}
		}
	}

	//--------------------------------------------------------------------------
	//	Fucntion : DoUploadFile()
	//  Outline  : upaload file to folder in the server
	//  Create   : ThanhTX 2007.05.02
	//--------------------------------------------------------------------------
	function DoUploadFileImg($dir){
		if ($_FILES["userfile"]['name'] != ""){			
			if(move_uploaded_file( $_FILES["userfile"]['tmp_name'], $dir.$_FILES["userfile"]['name'])){ 
			}
			else
			{
				echo "Không upload được file ảnh";
			}
		}
	}
	//--------------------------------------------------------------------------
	//	Fucntion : DoUploadFile1()
	//  Outline  : upaload file to folder in the server
	//  Create   : ThanhTX 2007.05.02
	//--------------------------------------------------------------------------
	function DoUploadFile1(){
		if ($_FILES["ten_anh"]['name'] != ""){
			$dir =DIR_UPLOADFILE_IMAGES;
			if(move_uploaded_file( $_FILES["ten_anh"]['tmp_name'], $dir.$_FILES["ten_anh"]['name'])){ 
				//echo "OK.";
			}
			else
			{
				echo "Khong upload duoc anh. Ban kiem tra lai ten anh xem co dung khong nhe.";
			}
		}
	}
}
?>